<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<div id="aa">
			
		</div>
		<button type="button" onclick="testget1()">get1</button>
		<button type="button" onclick="testpost1()">post1</button><br>
		<button type="button" onclick="testget2()">get2</button>
		<button type="button" onclick="testpost2()">post2</button><br>
		<button type="button" onclick="testget3()">get3</button>
		<button type="button" onclick="testpost3()">post3</button><br>
	</body>
	<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
	<script type="text/javascript">
	
		var aaobj = document.getElementById('aa')
		
		function testpost3(){
			var ajax = new XMLHttpRequest()
			ajax.open('POST','https://api.apiopen.top/deleteFeedback')
			ajax.setRequestHeader('Content-Type','application/json; charset=utf-8')
			ajax.send('apikey=9648872f9aa08da137ce45fe1dda8279&id=1')
			ajax.onreadystatechange = function(){
				if (ajax.readyState == 4 && ajax.status == 200) {
					var obj = ajax.responseText
					console.log(obj)
					alert('成功')
				}
			}
		}
		
		function testget3(){
			// var ajax = new XMLHttpRequest()
			// ajax.open('GET','http://poetry.apiopen.top/getTime')
			// ajax.send()
			// ajax.onreadystatechange = function(){
			// 	if (ajax.readyState == 4 && ajax.status == 200) {
			// 		var obj = ajax.responseText
			// 		console.log(obj)
			// 		aaobj.innerText = obj.result
			// }
			// }
			
			axios.get('http://poetry.apiopen.top/getTime').then(res=>{
				console.log(res);
			})
		}
		
		function testpost2(){
			var ajax = new XMLHttpRequest()
			ajax.open('POST','https://api.apiopen.top/deleteFeedback')
			ajax.setRequestHeader('Content-Type','application/json; charset=utf-8')
			ajax.send('apikey=9648872f9aa08da137ce45fe1dda8279&id=1')
			ajax.onreadystatechange = function(){
				if (ajax.readyState == 4 && ajax.status == 200) {
					alert('成功')
				}
			}
		}
		
		function testget2(){
			var ajax = new XMLHttpRequest()
			ajax.open('GET','http://poetry.apiopen.top/poetryFull?count=2&page=1')
			ajax.send()
			ajax.onreadystatechange = function(){
				if (ajax.readyState == 4 && ajax.status == 200) {
					var obj = JSON.parse(ajax.responseText)
					console.log(obj)
					aaobj.innerText=obj.result[0].type
				}
			}
		}
		
		function testget1(){
			var ajax = new XMLHttpRequest();
			ajax.open('GET','http://poetry.apiopen.top/sentences')
			ajax.send()
			ajax.onreadystatechange = function(){
				if (ajax.status == 200 && ajax.readyState == 4) {
					var obj = JSON.parse(ajax.responseText);
					
					console.log(obj.result)
					
					aaobj.innerText = obj.result.name
				}
			}
		}
		function testpost1(){
			var ajax = new XMLHttpRequest();
			ajax.open('POST','https://api.apiopen.top/getWangYiNews')
			ajax.setRequestHeader('Content-Type','application/json')
			ajax.send('page=1&count=5');
			ajax.onreadystatechange = function(){
				if (ajax.readyState == 4 && ajax.status == 200) {
					var obj = JSON.parse(ajax.responseText)
					console.log(obj.result[0].title)
					aaobj.innerText = obj.result[0].title
				}
			}
		}
	</script>
</html>
